package copyengine.network.roomStructure.executeLayer.component
{
	import flash.utils.ByteArray;

	public final class CENetworkExecuteHandleSubEncryptionComponent
	{
		public function CENetworkExecuteHandleSubEncryptionComponent()
		{
		}

		//=====================
		//== Encryption & Decryption
		//=====================

		public function encryptionForwardData(_forwardData:Object):ByteArray
		{
			if (_forwardData)
			{
				var byteArray:ByteArray = new ByteArray();
				byteArray.writeObject(_forwardData);
				byteArray.compress();
				return byteArray;
			}
			else
			{
				return null
			}
		}

		public function decryptionForwardData(_forwardDataByteArray:ByteArray):Object
		{
			if (_forwardDataByteArray)
			{
				_forwardDataByteArray.uncompress();
				var forwardData:Object = _forwardDataByteArray.readObject();
				return forwardData;
			}
			else
			{
				return null;
			}
		}
	}
}
